package com.xd100.lzll.gm.util;

/**
 * <br>
 * <b>@ClassName: </b>ControllerUtil<br>
 * <b>@Package: </b>com.xd100.lzll.gm.util<br>
 * <b>功能：Controller的辅助工具类</b><br>
 * <b>作者：</b>xiaoyu Mo (liujun)<br>
 * <b>日期：</b>2015-5-5 下午5:49:37 <br>
 * <b>版权所有：<b>版权所有(C) 2014，QQ 328321146<br>
 */
public class ControllerUtil {

	public static String getStackTraceFromException(Exception e) {
		StringBuffer sb = new StringBuffer();
		StackTraceElement[] sts = e.getStackTrace();
		sb.append(e.toString() + "\r\n");
		for (StackTraceElement st : sts) {
			sb.append(st.toString());
			sb.append("\r\n");
		}
		return sb.toString();
	}

	/**
	 * 判断参数是否为空
	 * 
	 * @return
	 */
	public static boolean parameterToJudge(String... params) {
		String[] strs = params;
		if (strs == null) {
			return false;
		}
		for (String param : strs) {
			if (param == null || "".equals(param)) {
				return false;
			}
		}
		return true;
	}

	/**
	 * @param cid
	 * @return 职业
	 */
	public static String getProfession(int cid) {
		switch (cid) {
			case 3300001:
				return "剑士(男)";
			case 3300002:
				return "猎人(男)";
			case 3300003:
				return "狂战(男)";
			case 3300029:
				return "剑士(女)";
			case 3300030:
				return "猎人(女)";
			case 3300031:
				return "狂战(女)";
			case 3300078:
				return "德鲁伊(男)";
			case 3300079:
				return "德鲁伊(女)";
			default:
				break;
		}
		return cid + "";
	}
}
